<template>
  <loading-text v-if="loading"></loading-text>
  <div v-else>
    <div class="form-list">
      <div class="title">
        <span>预录入信息</span>
      </div>
      <div class="form-list-item">
        <div class="label">姓名：</div>
        <div class="content">{{info.aac003 || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">身份证号：</div>
        <div class="content">{{info.aac002 || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">出生日期：</div>
        <div class="content">{{info.aac006 || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">曾用名：</div>
        <div class="content">{{info.expUserName || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">籍贯：</div>
        <div class="content">{{info.aac025 || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">出生地：</div>
        <div class="content">{{info.expCardNumber || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">性别：</div>
        <div class="content">{{info.aac004N || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">民族：</div>
        <div class="content">{{info.aac005N || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">婚姻状况：</div>
        <div class="content">{{info.aac017N || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">政治面貌：</div>
        <div class="content">{{info.aac024N || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">入党时间（参加组织时间）：</div>
        <div class="content">{{info.expPartyDate ? $dateFormat(info.expPartyDate).format('YYYY-MM-DD') : '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">参加工作时间：</div>
        <div class="content">{{info.expStartJobDate ? $dateFormat(info.expStartJobDate).format('YYYY-MM-DD') : '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">最高学位：</div>
        <div class="content">{{info.expAac037N || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">最高学历：</div>
        <div class="content">{{info.aac011N || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">毕业时间：</div>
        <div class="content">{{info.aac181 || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">最高学历毕业院校：</div>
        <div class="content">{{info.aac180 || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">最高学历所学专业：</div>
        <div class="content">{{info.expProfession || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">最高学历所学专业类别：</div>
        <div class="content">{{info.expAcc01gN || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">工作单位：</div>
        <div class="content">{{info.expWorkCompany || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">工作单位机构类型：</div>
        <div class="content">{{info.expWorkOrgN || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">工作单位经济类型：</div>
        <div class="content">{{info.expWorkEconomicsN || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">工作单位所属行业：</div>
        <div class="content">{{info.expWorkIndustryN || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">工作岗位类型：</div>
        <div class="content">{{info.expWorkPostN || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">工作地点行政区划：</div>
        <div class="content">{{info.expWorkZoning || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">居住所在地：</div>
        <div class="content">{{info.aab301 || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">邮政编码：</div>
        <div class="content">{{info.aae007 || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">手机号：</div>
        <div class="content">{{info.aae005 || '--'}}</div>
      </div>
      <div class="form-list-item">
        <div class="label">电子邮箱：</div>
        <div class="content">{{info.aae015 || '--'}}</div>
      </div>
    </div>
    <div v-if="info.personWorkExpceFormList && info.personWorkExpceFormList.length">
      <div class="line"></div>
      <div class="title">
        <span>工作经历</span>
      </div>
      <div>
        <div class="form-list list" v-for="(val, key) in info.personWorkExpceFormList" :key="key">
          <div class="form-list-item">
            <div class="label">开始时间</div>
            <div class="content">{{val.aae030 || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">结束时间</div>
            <div class="content">{{val.aae031 || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">工作单位</div>
            <div class="content">{{val.aac045 || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">担任职务</div>
            <div class="content">{{val.aac0b3 || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">证明人</div>
            <div class="content">{{val.aacb01 || '--'}}</div>
          </div>
        </div>
      </div>
    </div>
    <div v-if="info.personTitleQualificationFormList && info.personTitleQualificationFormList.length">
      <div class="line"></div>
      <div class="title">
        <span>专业技术与职业（工种）资格情况</span>
      </div>
      <div>
        <div class="form-list list" v-for="(val, key) in info.personTitleQualificationFormList" :key="key">
          <div class="form-list-item">
            <div class="label">职称名称</div>
            <div class="content">{{val.titleName || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">职称级别</div>
            <div class="content">{{val.titleLevel || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">取得专技资格日期</div>
            <div class="content">{{val.titleDate || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">职称（工种）资格名称</div>
            <div class="content">{{val.occupationName || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">国家职业（工种）资格等级</div>
            <div class="content">{{val.occupationLevel || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">国家职业（工种）资格等级日期</div>
            <div class="content">{{val.occupationDate || '--'}}</div>
          </div>
        </div>
      </div>
    </div>
    <div v-if="info.personLanguageFormList && info.personLanguageFormList.length">
      <div class="line"></div>
      <div class="title">
        <span>语言能力</span>
      </div>
      <div>
        <div class="form-list list" v-for="(val, key) in info.personLanguageFormList" :key="key">
          <div class="form-list-item">
            <div class="label">语种</div>
            <div class="content">{{val.languageName || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">语种熟练程度</div>
            <div class="content">{{val.languageSkilledName || '--'}}</div>
          </div>
        </div>
      </div>
    </div>
    <div v-if="info.personEducationFormList && info.personEducationFormList.length">
      <div class="line"></div>
      <div class="title">
        <span>教育经历</span>
      </div>
      <div>
        <div class="form-list list" v-for="(val, key) in info.personEducationFormList" :key="key">
          <div class="form-list-item">
            <div class="label">入校日期</div>
            <div class="content">{{val.aae030 || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">离校日期</div>
            <div class="content">{{val.aac046 || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">所在学校</div>
            <div class="content">{{val.aac045 || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">所学专业</div>
            <div class="content">{{val.acc01g || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">所获学位</div>
            <div class="content">{{val.aac037 || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">所获学历</div>
            <div class="content">{{val.atc011 || '--'}}</div>
          </div>
        </div>
      </div>
    </div>
    <div v-if="info.personSituationFormList && info.personSituationFormList.length">
      <div class="line"></div>
      <div class="title">
        <span>家庭情况</span>
      </div>
      <div>
        <div class="form-list list" v-for="(val, key) in info.personSituationFormList" :key="key">
          <div class="form-list-item">
            <div class="label">家庭成员姓名</div>
            <div class="content">{{val.siName || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">与本人的关系</div>
            <div class="content">{{val.siRelation || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">家庭成员工作单位及职务</div>
            <div class="content">{{val.siNamePost || '--'}}</div>
          </div>
        </div>
      </div>
    </div>
    <div v-if="info.personRewardPunishmentFormList && info.personRewardPunishmentFormList.length">
      <div class="line"></div>
      <div class="title">
        <span>奖惩信息</span>
      </div>
      <div>
        <div class="form-list list" v-for="(val, key) in info.personRewardPunishmentFormList" :key="key">
          <div class="form-list-item">
            <div class="label">类型</div>
            <div class="content">{{Number(val.type) === 1 ? '奖励' : '惩罚'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">名称</div>
            <div class="content">{{val.rewardName || val.punishmentName || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">时间</div>
            <div class="content">{{val.punishmentDate || val.rewardDate || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">批准单位</div>
            <div class="content">{{val.punishmentCompanyName || val.rewardCompanyName || '--'}}</div>
          </div>
        </div>
      </div>
    </div>
    <div v-if="info.personTrainFormList && info.personTrainFormList.length">
      <div class="line"></div>
      <div class="title">
        <span>培训经历</span>
      </div>
      <div>
        <div class="form-list list" v-for="(val, key) in info.personTrainFormList" :key="key">
          <div class="form-list-item">
            <div class="label">开始时间</div>
            <div class="content">{{val.aae030 || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">结束时间</div>
            <div class="content">{{val.aae031 || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">培训机构名称</div>
            <div class="content">{{val.acc0b1 || '--'}}</div>
          </div>
          <div class="form-list-item">
            <div class="label">培训主办单位</div>
            <div class="content">{{val.aaab01 || '--'}}</div>
          </div>
        </div>
      </div>
    </div>
    <div>
      <div class="line"></div>
      <div class="title">
        <span>商调函信息</span>
      </div>
      <div class="form-list">
        <div class="form-list-item">
          <div class="label">审核状态：</div>
          <div class="content">{{detail.message || '--'}}</div>
        </div>
        <div class="form-list-item" v-if="detail.archiveLetterForm">
          <div class="label">原存档单位：</div>
          <div class="content">{{detail.archiveLetterForm.originalArchiveUnit || '--'}}</div>
        </div>
        <div class="form-list-item" v-if="detail.archiveLetterForm">
          <div class="label">档案所在地：</div>
          <div class="content">{{Number(detail.archiveLetterForm.archiveAddress) === 0 ? '原单位' : '人才服务机构'}}</div>
        </div>
      </div>
      <mt-button size="large" type="primary" v-if="detail.urlPath" @click="download">下载商调函</mt-button>
    </div>
  </div>
</template>

<script>
  import LoadingText from '../../../components/loading-text/loading-text'
  import {mapGetters} from 'vuex'
  import {download} from '../../../common/js/util'

  export default {
    name: 'detail-apply',
    components: {LoadingText},
    computed: {
      ...mapGetters([
        'userInfo'
      ])
    },
    data() {
      return {
        loading: true,
        detail: {},
        info: {}
      }
    },
    methods: {
      getDetail() {
        // 商调函信息查询
        this.$post('/admin/person/sapi/personal/records/perEntry/get/archive/letter/info', {
          cardId: this.userInfo.idCard,
          name: this.userInfo.name
        }, loading => { this.loading = loading }).then(res => {
          this.detail = res.data
        })
      },
      getInfo() {
        this.$post('/admin/person/sapi/personal/records/perEntry/get/audit/state', {
          cardId: this.userInfo.idCard,
          name: this.userInfo.name
        }).then(res => {
          this.info = res.data
        })
      },
      download() {
        download(this.$getImg(this.detail.urlPath, {type: 'pdf'}))
      }
    },
    created() {
      this.getDetail()
      this.getInfo()
    }
  }
</script>

<style scoped lang="scss">
  @import "../../../common/style/variable";
  .title{
    padding: .2rem;
    border-bottom: 1px solid #ededed;
    background: #fff;
    span{
      display: inline-block;
      padding: 0 .2rem;
      border-left: 4px solid $primary;
    }
  }
  .line{
    height: .2rem;
    background: #f5f5f5;
  }
  .list{
    &:not(:last-child){
      border-bottom: 1px dashed $label;
    }
  }
</style>
